home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / libray / libcommon / xform.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  2.0 KB  |  83 lines

  1. /*
  2.  * xform.c
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  * 
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * xform.c,v 4.1 1994/08/09 07:55:32 explorer Exp
  17.  *
  18.  * xform.c,v
  19.  * Revision 4.1  1994/08/09  07:55:32  explorer
  20.  * Bump version to 4.1
  21.  *
  22.  * Revision 1.1.1.1  1994/08/08  04:52:02  explorer
  23.  * Initial import.  This is a prerelease of 4.0.6enh3, or 4.1 possibly.
  24.  *
  25.  * Revision 4.0.1.1  91/10/04  15:51:53  cek
  26.  * patch1: Initial revision.
  27.  * 
  28.  * Revision 4.0  1991/09/29  15:34:31  cek
  29.  * Initial version.
  30.  *
  31.  */
  32. #include "common.h"
  33. #include "xform.h"
  34.  
  35. TransMethods *iXformMethods;
  36.  
  37. /*
  38.  * Create and return reference to an Xform structure.
  39.  * In this case, we return a NULL pointer, as the Xform
  40.  * structure does not hold any data.
  41.  */
  42. Xform *
  43. XformCreate()
  44. {
  45.     return (Xform *)NULL;
  46. }
  47.  
  48. /*
  49.  * Return a pointer to collection of methods for the
  50.  * Xform transformation.
  51.  */
  52. TransMethods *
  53. XformMethods()
  54. {
  55.     if (iXformMethods == (TransMethods *)NULL) {
  56.         iXformMethods = (TransMethods *)Malloc(sizeof(TransMethods));
  57.         iXformMethods->create = (TransCreateFunc *)XformCreate;
  58.         iXformMethods->propagate = XformPropagate;
  59.     }
  60.     return iXformMethods;    
  61. }
  62.  
  63. /*
  64.  * Given an Xform structure and forward and inverse transformations,
  65.  * propagate the information in the Xform structure to the
  66.  * transformations.
  67.  * In this case, the information "in" the Xform structure is
  68.  * actually stored in the forward transformation; the Xform
  69.  * points to NULL.
  70.  */
  71. void
  72. XformPropagate(xform, trans, itrans)
  73. Xform *xform;
  74. RSMatrix *trans, *itrans;
  75. {
  76.     /*
  77.      * The Xform methods change the forward trans
  78.      * directly, so it's already all set.
  79.      * Build the inverse...
  80.      */
  81.     MatrixInvert(trans, itrans);
  82. }
  83.